package cst.start.teachresourceplatform117zx.Fragment;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import cst.start.teachresourceplatform117zx.R;
import cst.start.teachresourceplatform117zx.activity.CMainActivity;


public class MeFragment extends Fragment {

    private View view=null;
    private Context context;
    private Button btnfh,btnsc;
    private SharedPreferences sp;
    private String username;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        context=getActivity();
        //动态加载Fragment1的布局文件
        view=inflater.inflate(R.layout.mefragment,container,false);
        //获取布局上的控件，注意通过view获取
        btnfh=(Button)view.findViewById(R.id.button2);
        btnsc=(Button)view.findViewById(R.id.button3);
        btnfh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.button2:
                        getActivity().onBackPressed();
                        break;
                }
            }
        });
        btnsc.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.button3:
                        Intent intent=new Intent(getActivity(), CMainActivity.class);
                        startActivity(intent);
                        break;
                }
            }
        });
        return view;
    }
}
